<template>
  <el-dialog title="新增设备" :visible="isShowAddDialog" class="form">
    <el-form :model="regionList">
      <el-form-item label="设备编号：" prop="createUserId">
        <el-input v-model="regionList.createUserId" type="text" readonly />
      </el-form-item>
      <el-form-item label="选择型号：" prop="type.name">
        <el-select v-model="regionList.type[name]" placeholder="请选择">
          <el-option v-for="item in formData" :key="item.vmType" :value="item.type.name" />
        </el-select>
      </el-form-item>
      <el-form-item label="选择点位：" prop="node.name">
        <el-select v-model="regionList.node[name]" placeholder="请选择">
          <el-option v-for="item in formData" :key="item.nodeId" :value="item.node.name" />
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer" center>
      <el-button>取 消</el-button>
      <el-button type="primary" @click="btnOK">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getSearchVm } from '@/api/goods'
export default {
  props: {
    isShowAddDialog: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      formData: [
        { vmType: '' },
        { nodeId: '' }
      ],
      regionList: {
        vmType: '',
        nodeId: '',
        createUserId: ''
      }
    }
  },
  async created() {
    const res = await getSearchVm()
    this.formData = res.data.currentPageRecords
    console.log('123', this.formData)
  },
  methods: {
    btnOK() {}
    // async btnOK() {
    //   const res = await addVm(this.formData)
    //   // this.regionList = res
    //   console.log(res)
  }
}

</script>

<style scoped>

.form .el-form-item{
  vertical-align:middle;
       width: 50%;
  }

</style>
